package com.warframe.luckdraw;

import com.tools.StringContent;
import com.warframe.entity.message.Message;
import com.warframe.message.Executor;

import java.util.Random;

public class LuckDraw implements Runnable {

    private final static String msg = "恭喜 [CQ:at,qq=FROMQQ] 同学抽中 BANTIME 秒禁言套餐！";
    private Message message;

    public LuckDraw(Message message) {
        this.message = message;
    }

    @Override
    public void run() {
        Random random = new Random();
        Integer banTime = random.nextInt(180) + 1;
        Executor.getCQ().setGroupBan(message.getGroupId(), message.getFromQQ(), banTime);
        message.setSign(StringContent.SENDGROUP);
        message.setMsg(msg.replace("FROMQQ", message.getFromQQ().toString()).replace("BANTIME", banTime.toString()));
        Executor.getInstance().pushMsg(message);
    }

}
